package com.andro.inje.chansung;

import com.andro.inje.chansung.bus.BusTimeActivity;
import com.andro.inje.chansung.careerboard.CareerBoardActivity;
import com.andro.inje.chansung.department.DepartmentActivity;
import com.andro.inje.chansung.foodtable.FoodTableActivity;
import com.andro.inje.chansung.freeboard.FreeBoardActivity;
import com.andro.inje.chansung.information.InformationActivity;
import com.andro.inje.chansung.noticeboard.NoticeBoardActivity;
import com.andro.inje.chansung.phonebook.PhoneBookActivity;
import com.andro.inje.chansung.proffesor.ProffesorActivity;

import android.app.Activity;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class InjeCSEPRoActivity extends Activity implements OnClickListener {
  	 private static final boolean IS_DB_DEBUG_MODE = true;

     public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        SQLiteDatabase db = openOrCreateDatabase(ConstantName.DATABASE_NAME, MODE_WORLD_WRITEABLE, null);
        if( IS_DB_DEBUG_MODE ) {
        		DB.removeNoticeTable(db);
        }
        DB.createNoticeTable(db);
        db.close();
        
        Button menuNoticeBtn 		= (Button)findViewById(R.id.menu_notice_board_btn);
        Button menuDepartmentBtn 	= (Button)findViewById(R.id.menu_department_intro_btn);
        Button menuProffesorBtn		= (Button)findViewById(R.id.menu_proffesor_intro_btn);
        Button menuCareerBtn 		= (Button)findViewById(R.id.menu_career_board_btn);
        Button menuFreeBtn 			= (Button)findViewById(R.id.menu_free_board_btn);
        Button menuBusBtn 			= (Button)findViewById(R.id.menu_bus_time_btn);
        Button menuFoodBtn 			= (Button)findViewById(R.id.menu_food_table_btn);
        Button phoneBookBtn			= (Button)findViewById(R.id.menu_phone_book_btn);
        Button informationBtn		= (Button)findViewById(R.id.menu_information_btn);
        
        menuNoticeBtn.setOnClickListener(this);
        menuDepartmentBtn.setOnClickListener(this);
        menuProffesorBtn.setOnClickListener(this);
        menuCareerBtn.setOnClickListener(this);
        menuFreeBtn.setOnClickListener(this);
        menuBusBtn.setOnClickListener(this);
        menuFoodBtn.setOnClickListener(this);
        phoneBookBtn.setOnClickListener(this);
        informationBtn.setOnClickListener(this);
    }

	public void onClick(View v) {
		Intent intent = null;
		
		switch( v.getId() ) {
		case R.id.menu_notice_board_btn :
			intent = new Intent(this, NoticeBoardActivity.class);
			break;
			
		case R.id.menu_department_intro_btn :
			intent = new Intent(this, DepartmentActivity.class);
			break;
			
		case R.id.menu_proffesor_intro_btn :
			intent = new Intent(this, ProffesorActivity.class);
			break;
			
		case R.id.menu_career_board_btn :
			intent = new Intent(this, CareerBoardActivity.class);
			break;
			
		case R.id.menu_free_board_btn :
			intent = new Intent(this, FreeBoardActivity.class);
			break;
			
		case R.id.menu_bus_time_btn :
			intent = new Intent(this, BusTimeActivity.class);
			break;
			
		case R.id.menu_food_table_btn : 
			intent = new Intent(this, FoodTableActivity.class);
			break;
			
		case R.id.menu_phone_book_btn :
			intent = new Intent(this, PhoneBookActivity.class);
			break;
			
		case R.id.menu_information_btn :
			intent = new Intent(this, InformationActivity.class);
			break;
		}
		
		startActivity(intent);
	}
}